# Copyright (c) 2018 Presto Labs Pte. Ltd.
# Author: xguo


import json
import logging
import os
from coin2.support.product_info.spot_okex_v5 import convert_coin1_constants


pi_file = 'data/coin2/product_info/old_compat/okex.json'
with open(pi_file) as f:
  static_constants = convert_coin1_constants(json.load(f)['product_infos'])
active_base_currency_list = [
    "BCHABC",
    "BCHSV",
    "BTC",
    "BTG",
    "EOS",
    "ETC",
    "ETH",
    "IOTA",
    "LTC",
    "NEO",
    "ONT",
    "QTUM",
    "TRX",
    "XRP",
]


dynamic_constants = {}
if int(os.getenv('USE_DYNAMIC_SYMBOL', 0)):
  try:
    from coin2.support.product_info.spot_okex_v3 import gen_coin1_constants
    dynamic_constants = gen_coin1_constants()
  except Exception as e:
    logging.error('Failed to use okex dynamic symbols! %s', e)


quote_currency_list = list(set(
    ['USD'] +
    static_constants.get('quote_currency_list', []) +
    dynamic_constants.get('quote_currency_list', [])))
currency_list = list(set(
    ['USD'] +
    static_constants.get('currency_list', []) +
    dynamic_constants.get('currency_list', [])))
symbol_list = list(set(
    static_constants.get('symbol_list', []) +
    dynamic_constants.get('symbol_list', [])))
